// MESSAGE AUTO_TRACE support class

#pragma once

namespace mavlink {
namespace fppa {
namespace msg {

/**
 * @brief AUTO_TRACE message
 *
 * auto trace target satellite
 */
struct AUTO_TRACE : mavlink::Message {
    static constexpr msgid_t MSG_ID = 201;
    static constexpr size_t LENGTH = 39;
    static constexpr size_t MIN_LENGTH = 39;
    static constexpr uint8_t CRC_EXTRA = 109;
    static constexpr auto NAME = "AUTO_TRACE";


    uint8_t mode; /*<   start or stop... */
    float sat_longitude; /*<  satellite longitude. */
    uint8_t ant_id; /*<  antenna id. */
    uint32_t sat_id; /*<  satellite id. */
    float sat_polar; /*<  receive satellite signal polar:left(-45) or right(+45). */
    uint8_t local_gps_type; /*<  local gps type:auto or manual. */
    float local_longitude; /*<  local longitude. */
    float local_latitude; /*<  local latitude. */
    float local_altitude; /*<  local altitude. */
    float res1; /*<  res1. */
    float res2; /*<  res2. */
    float res3; /*<  res3. */


    inline std::string get_name(void) const override
    {
            return NAME;
    }

    inline Info get_message_info(void) const override
    {
            return { MSG_ID, LENGTH, MIN_LENGTH, CRC_EXTRA };
    }

    inline std::string to_yaml(void) const override
    {
        std::stringstream ss;

        ss << NAME << ":" << std::endl;
        ss << "  mode: " << +mode << std::endl;
        ss << "  sat_longitude: " << sat_longitude << std::endl;
        ss << "  ant_id: " << +ant_id << std::endl;
        ss << "  sat_id: " << sat_id << std::endl;
        ss << "  sat_polar: " << sat_polar << std::endl;
        ss << "  local_gps_type: " << +local_gps_type << std::endl;
        ss << "  local_longitude: " << local_longitude << std::endl;
        ss << "  local_latitude: " << local_latitude << std::endl;
        ss << "  local_altitude: " << local_altitude << std::endl;
        ss << "  res1: " << res1 << std::endl;
        ss << "  res2: " << res2 << std::endl;
        ss << "  res3: " << res3 << std::endl;

        return ss.str();
    }

    inline void serialize(mavlink::MsgMap &map) const override
    {
        map.reset(MSG_ID, LENGTH);

        map << sat_longitude;                 // offset: 0
        map << sat_id;                        // offset: 4
        map << sat_polar;                     // offset: 8
        map << local_longitude;               // offset: 12
        map << local_latitude;                // offset: 16
        map << local_altitude;                // offset: 20
        map << res1;                          // offset: 24
        map << res2;                          // offset: 28
        map << res3;                          // offset: 32
        map << mode;                          // offset: 36
        map << ant_id;                        // offset: 37
        map << local_gps_type;                // offset: 38
    }

    inline void deserialize(mavlink::MsgMap &map) override
    {
        map >> sat_longitude;                 // offset: 0
        map >> sat_id;                        // offset: 4
        map >> sat_polar;                     // offset: 8
        map >> local_longitude;               // offset: 12
        map >> local_latitude;                // offset: 16
        map >> local_altitude;                // offset: 20
        map >> res1;                          // offset: 24
        map >> res2;                          // offset: 28
        map >> res3;                          // offset: 32
        map >> mode;                          // offset: 36
        map >> ant_id;                        // offset: 37
        map >> local_gps_type;                // offset: 38
    }
};

} // namespace msg
} // namespace fppa
} // namespace mavlink
